<?php
namespace Admin\Controller;
use Think\Controller;
class PlatformController extends CommonController {
    /*
    * 方法: platform_set
    * 功能：平台设置
    * 传参：无
   **/
    public function platform_set()
    {
        $ptitle = '平台管理';
        $title = '首页';
        $platform_set = M('platform_set')->where(array('id' => 2))->find();
        $this->assign('platform_set',$platform_set);
        $this->assign('ptitle',$ptitle);
        $this->assign('title',$title);
        $this->display();
    }

    /*
    * 方法: platform_set_edit
    * 功能：平台设置--编辑
    * 传参：无
   **/
    public function platform_set_edit()
    {
        if(IS_POST)
        {
            $data['logo'] = uploadPicture();
            $data['id'] = 2;
            $data['title'] = I('title');
            $data['keywords'] = I('keywords');
            $data['description'] = I('description');
            $data['copyright'] = I('copyright');
            $data['record'] = I('record');

            $platform_set_result = M('platform_set')->save($data);
            if($platform_set_result === false)
            {
                $this->error('平台设置失败',U('platform_set'),0);
            }else{
                $this->success('平台设置成功',U('platform_set'),1);
            }
            exit;
        }
        //展示待编辑信息
        $platform_set = M('platform_set')->where(array('id' => 2))->find();
        $ptitle = '平台管理';
        $title = '平台修改';
        $this->assign('ptitle',$ptitle);
        $this->assign('title',$title);
        $this->assign('platform_set',$platform_set);
        $this->display();
    }
}